#!/bin/bash

# The bash shell if statement runs the command defined on the if line. If the
# exit status of the command (see Chapter 10) is zero (the command completed
# successfully), the commands listed under the then section are executed. If the
# exit status of the command is anything else, the then commands aren't 
# executed, and the bash shell moves on to the next command in the script.

if date; then
    echo "it worked"
fi

testuser=binson
if grep $testuser /etc/passwd; then
    echo "The files for user $testuser are:"
    ls -a /home/$testuser/.b*
else
    echo "The user name $testuser does not exist on this system"
fi

# if command1; then
#    command set 1
# elif command2; then
#    command set 2
# elif command3; then
#    command set 3
# elif command4; then
#    command set 4
# fi

case $USER in
binson | barbara)
    echo "Welcome, $USER"
    echo "Please enjoy your visit"
    ;;
testing)
    echo "Special testing account"
    ;;
jessica)
    echo "Do not forget to log off when you're done"
    ;;
*)
    echo "Sorry, you are not allowed here"
    ;;
esac

